package com.web.music.portal.mvc;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import com.web.music.interfaces.GenreService;
import com.web.music.interfaces.SecurityController;
import com.web.music.model.Genre;

public class ListAllGenreController implements Controller {

	private GenreService genreService;
	private SecurityController securityController;
	
	public GenreService getGenreService() {
		return genreService;
	}

	public void setGenreService(GenreService genreService) {
		this.genreService = genreService;
	}

	public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) 
	throws Exception 
	{
		List<Genre> genres = genreService.findAll();
		securityController.updateSecurityStatus(request, genres);
		return new ModelAndView("genre_listall", "list", genres);
	}
	public SecurityController getSecurityController() {
		return securityController;
	}

	public void setSecurityController(
			SecurityController securityController) {
		this.securityController = securityController;
	}
	
}